package com.huilian.iotbox.client.controller;

import com.alibaba.fastjson.JSONObject;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.controller.BaseController;
import com.huilian.tool.ali.applet.service.AliAppletService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: loong
 * @create: 2023-04-07 16:06
 **/
@RestController
@RequestMapping("/api/aliApplet")
public class AliAppletController extends BaseController {
    @Resource
    private AliAppletService aliAppletService;

    @PostMapping("/getUserInfoShare")
    public ServerResponse getUserInfoShare(@RequestBody JSONObject jsonObject) {
        try {
            return ServerResponse.createBySuccess(aliAppletService.getUserInfoShare(jsonObject.getString("authCode")));
        } catch (Exception e) {
            return ServerResponse.createByErrorMessage(e.getMessage());
        }
    }
}
